using System.Collections.Generic;
using System.Linq;

namespace LS.Saving
{
    public class DataBaseExtension
    {
        public static void Inject(Database database, Dictionary<string,object> injection)
        {
            var dataDic = database.GetDataDictionary();
            foreach (KeyValuePair<string, object> keyValuePair in injection)
            {
                dataDic.Add(keyValuePair.Key, keyValuePair.Value);
            }
        }

        public static Dictionary<string,object> Eject(Database database)
        {
            return database.GetDataDictionary()
                .ToDictionary(d => d.Key, d => d.Value);
        }
    }
}